package Spring5.第二章.demo2_7_策略模式.卖课;

public class Main {
    public static void main(String[] args) {
//        demo01();

//        demo02();

        String promotionKey = "GROUPBUY";
        PromotionActity promotionActity = new PromotionActity(PromotionStrategyFactory.getPromotionStrategy(promotionKey));
        promotionActity.execute();
    }

    private static void demo02() {
        PromotionActity promotionActity = null;

        String promotionKey = "COUPON";

        if("COUPON".equals(promotionKey)) {
            promotionActity = new PromotionActity(new CouponStrategy());
        } else if ("CASHBACK".equals(promotionKey)) {
            promotionActity = new PromotionActity(new CashbackStrategy());
        }
        promotionActity.execute();
    }

    private static void demo01() {
        PromotionActity actity618 = new PromotionActity(new CouponStrategy());
        PromotionActity actity1111 = new PromotionActity(new CashbackStrategy());

        actity618.execute();
        actity1111.execute();
    }
}
